<div class="asidetop">
    <ul class="tab_navs">
        <li class="selected">
            <a onclick="getRight('/Sucai/single');"  href="javascript:void(0)">添加单图文消息</a>
        </li>
        <li >
            <a onclick="getRight('/Sucai/double');" href="javascript:void(0)">添加多图文消息</a>
        </li>
         <li>
            <a onclick="getRight('/Sucai/text');" href="javascript:void(0)">添加文本消息</a>
        </li>
         <li>
            <a onclick="getRight('/Sucai/image');" href="javascript:void(0)">添加图片消息</a>
        </li>
        
    </ul>
</div>
<div style="padding:30px 20px 0">
	
	
    <div class="media_preview_area">
        <div class="appmsg  editing">
            <div class="appmsg_content">
                <div class="js_appmsg_item ">
                    <h4 class="appmsg_title"><a href="javascript:void(0);">标题</a></h4>
                    <div class="appmsg_info">
                        <em class="appmsg_date"></em>
                    </div>
                    <div class="appmsg_thumb_wrp">
                        <img src="" class="js_appmsg_thumb appmsg_thumb"><i class="appmsg_thumb default">封面图片</i>
                    </div>
                    <p class="appmsg_desc">
                    </p>
                </div>
            </div>
        </div>
    </div>
	
	
	
    <div class="media_edit_area">
            <div class="appmsg_editor" style="margin-top: 0px;">
                <div class="inner">
                	<form action="/Sucai/add_single" method="post" id="postfrom">
                		<input type="hidden" name="cover" id="post_pic">
                                <input type="hidden" name="type" value="news" />
                    <div class="appmsg_edit_item">
                        <label class="frm_label">
                            标题
                        </label>
                        <span class="frm_input_box"><input type="text" name="title" class="frm_input js_title"></span>
                    </div>

                   <div class="appmsg_edit_item">
                        <label class="frm_label">
                            <strong class="title">封面</strong>
                            <p class="js_cover_tip tips r">
                                大图片建议尺寸：360像素 * 200像素
                            </p>
                        </label>
                        <input id="file_upload" name="pib" type="file">
                    </div>
                                
                    <div class="js_desc_area dn appmsg_edit_item">
                        <label class="frm_label">
                            摘要
                        </label>
                        <span class="frm_textarea_box">
                            <textarea name="abstract" class="js_desc frm_textarea">
                            </textarea>
                        </span>
                    </div>
                    <div class="appmsg_edit_item content_edit">
                        <a class="icon16_common close jsClose" href="javascript:void(0);">关闭</a>
                        <label class="frm_label">
                            <strong class="title">正文</strong>
                        </label>
                        <script id="editor" type="text/plain" name="content" style="width:380px;height:360px;"></script>
                        <div class="tool_bar tc">
                            <button class="btn btn_primary" id="submits" href="javascript:void(0);" >完成编辑</button>
                        </div>
                    </div>
					</form>
                </div>
            </div>
    </div>
	
</div>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	$(function() {
            
           //图文编辑
    $('.js_title').live('keyup',function(){
        $('.appmsg_title').html($(this).val());
    });
    $('.js_desc').live('keyup',function(){
        $('.appmsg_desc').html($(this).val());
    });
	
    $('.data_box li').live('click',function(){
        $('.data_box li').attr('class','');
        $(this).attr('class','on');
        $('#sid').val($(this).attr('id'));
        $('#title').html($(this).html());
    });     
            
            
            
            
            
		UE.getEditor('editor');
		$('#postfrom').ajaxForm({
			beforeSubmit:function(){
				$('.js_desc').val($.trim($('.js_desc').val()));
				if (!$('.js_title').val()) {
					successBox('error','请填写标题！');
					return false
				}
				if (!$('#post_pic').val()) {
					successBox('error','请上传图片！');
					return false
				}
				if (!$('.js_desc').val()) {
					successBox('error','请填写摘要！');
					return false
				}
				if (!UE.getEditor('editor').getContent()) {
					successBox('error','请填写正文！');
					return false
				}
				$('#submits').attr('disabled','true');
				return true;
			},
			success:function(){
				successBox('success','上传成功！',1000);
				getRight('/Sucai/single');
			},
			dataType: 'json'
		});
			
		$('#file_upload').uploadify({
			'swf'      : '/Public/js/uploadify/uploadify.swf',
			'uploader' : '/Public/js/uploadify/uploadify.php',
			'buttonText':'上传',
			'height':'25',
			'width':'60',
			'queueSizeLimit' : 1,
			'onUploadSuccess' : function(file, data, response) {
									data =  $.trim(data);
    								if(data!='error'){
										$('.js_appmsg_thumb').attr('src',data).show();
										$('#post_pic').val(data);
									}
								},
		});
	});

</script>
